package com.pocketpets.gamelogic;

import java.util.ArrayList;
import java.util.Random;

import com.pocketpets.globaldata.ItemListClass;
import com.pocketpets.globaldata.LocationData;

public class ARLogic 
{	private static ArrayList<LocationData> itemList=ItemListClass.getInstance().getItemList();
	private static ArrayList<LocationData> inRangePet = ItemListClass.getInstance().getItemList();
	public void InRangeArray(double Longtitude, double Lantitude, double Range)
	{
		double point1X = Longtitude - Range; 
		double point1Y = Lantitude - Range; 
		double point2X = Longtitude + Range;
		double point2Y = Lantitude + Range;
		for(int i = 0; i < itemList.size(); i++)
		{
			if(point1X < itemList.get(i).getLng() && itemList.get(i).getLng() < point2X && point1Y < itemList.get(i).getLat() && itemList.get(i).getLat() < point2Y)
			{
				inRangePet.add(itemList.get(i));
			}
		}
	}
	
	public LocationData BattlePet(ArrayList<LocationData> battlePetList) 
	{
		double randomNumber;
		int randomNum;
		
		Random rn = new Random();
		int n = 10 - 0 + 1;
		int i = rn.nextInt() % n;
		randomNum =  0 + i;
		randomNumber = randomNum/10;
		double result;
		
		for(int k = 0; k < battlePetList.size(); k++)
		{
			result = battlePetList.get(k).getProp()- randomNumber;
			if(result < 0)
			{
				return battlePetList.get(k)
			}
			
		}

	}

}

